package com.nave.view;

import nave.control.Options;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.nave.R;
import com.nave.utils.SoundController;

public class CreditsActivity extends Activity
{	
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		setContentView(R.layout.credits);
		setupButtons();
	}
	@Override
	protected void onResume()
	{
		super.onResume();

		if ( Options.sound() && !MainMenu.mediaPlayer.isPlaying() )
			MainMenu.mediaPlayer.start();
		
	}

	private void playClickSound()
    {
    	SoundController.getReference().
			playSound(SoundController.CLICK, getApplicationContext());
    }

	private void setupButtons()
	{	
		Button back = (Button) findViewById(R.id.credits_back);

		back.setOnClickListener(new Button.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				playClickSound();
				CreditsActivity.this.finish();
			}
		});	
	}
}
